public class nimingClass {

    interface HelloWrold{
        void greet();
        void greetSomeone(String someone);
    }

    public void sayHello(){
        //局部类EnglishGreeting实现了HelloWorld接口；
        class EnglishGreeting implements HelloWrold{
            String name = "World";
            @Override
            public void greet() {
                greetSomeone("World");
            }
            @Override
            public void greetSomeone(String someone) {
                someone = name;
                System.out.println("Hello" + name);
            }
        }
        HelloWrold englishGreeting = new EnglishGreeting();

        //匿名类实现HelloWrold接口
        HelloWrold  frenchGreeting = new HelloWrold(){
            String name = "tout le monde";

            @Override
            public void greet() {
                greetSomeone("tout le monde");
            }

            @Override
            public void greetSomeone(String someone) {
                name = someone;
                System.out.println("hello"+name);
            }
        };


        //匿名类实现HelloWrold接口
        HelloWrold  spaninshGreeing = new HelloWrold(){
            String name = "mundo";

            @Override
            public void greet() {
                greetSomeone("mundo");
            }

            @Override
            public void greetSomeone(String someone) {
                name = someone;
                System.out.println("Hola"+ name);
            }
        };
        englishGreeting.greet();
        frenchGreeting.greetSomeone("Fred");
        spaninshGreeing.greet();

    }

    public static void main(String[] args) {
        nimingClass nimingClass = new nimingClass();
        nimingClass.sayHello();
        Runnable runnable = new Runnable() {
            @Override
            public void run() {

            }
        };

        Runnable runnable2 = () -> new Runnable() {
            @Override
            public void run() {

            }
        };
    }
}
